package com.java3_14;

import java.util.Arrays;
import java.util.Objects;

public class java3_14 {
    //    public static void main(String[] args) {
//        //Math工具类
//        //绝对值
//
////        int a = -10;
////        System.out.println(Math.abs(a));
////        System.out.println(Math.abs(-3.14));
////
////        //当整数超过范围的时候就会报错
////        //System.out.println(Math.abs(-23456789234567));
////
////        System.out.println(Math.absExact(-123456782345678L));
////        System.out.println(Math.abs(-234567823456789L));
//
//        //取整运算
//        //ceil + floor + round
////        System.out.println(Math.ceil(3.14));
////        System.out.println(Math.floor(3.14));
////        //先取整在添加正负号
////        System.out.println(Math.round(-3.54));
//
//        //最大最小值
////        System.out.println(Math.max(10,20));
////        System.out.println(Math.min(10,20));
//
//        //次方类
////        int a = 16;
////        System.out.println(Math.pow(a, 3));
////        System.out.println(Math.sqrt(a));
////        System.out.println(Math.cbrt(a));
//
////        System.out.println(Math.random());
//
//    }
//    public static void main(String[] args) throws CloneNotSupportedException {
//        //System中的方法
//
////        try{
////            int a = 10;
////            System.out.println(a / 0);
////        }catch (ArithmeticException e){
////            e.printStackTrace();
////        }finally {
////            //停止虚拟机运行
////            System.exit(0);
////            System.out.println("异常已被捕获");
////        }
//
//
////        long begin = System.currentTimeMillis();
////        for (int i = 0; i < 100; i++) {
////            System.out.println(i);
////        }
////        long end = System.currentTimeMillis();
////        System.out.println("时间过去了" + (end - begin));
//
//
////        System.out.println(System.currentTimeMillis());
//        //
//
//        //数组的复制 - arraycopy
//
////        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
////        int[] dest = new int[10];
////        System.arraycopy(arr,0,dest,0,5);
////        for(int number : dest){
////            System.out.println(number);
////        }
//
//        //Object - toString方法
//        //toString - 返回对象的字符串表示形式
//
////        Student student1 = new Student("zhangsan",20);
////        Student student2 = new Student("zhangsan",20);
//////        Student student2 = new Student("",22);
//////        System.out.println(student2 == student1);
////        //不重写就是判断是否是自己
////
////        //重写之后就是判断里面的内容是否相同
////        System.out.println(student1.equals(student2));
//
//        //如果没有equals方法就使用Object类里面的方法
//
//
//        //浅克隆
////        Student student1 = new Student("zhangsan",20);
//////        Student clone = (Student) student1.clone();
//////        System.out.println(clone.toString());
////        Student clone = (Student) student1.clone();
////        System.out.println(clone.toString());
//
//        //深克隆
////        Student student = new Student("zhangsan",22,new int[5]);
////        Student clone = (Student) student.clone();
////        System.out.println(clone.toString());
//
//
//    }
//    public static void main(String[] args) {
//        //finalize -
////        Student student = new Student();
////        try {
////            Thread.sleep(3000);
////        } catch (InterruptedException e) {
////            throw new RuntimeException(e);
////        }
////        System.out.println("操作结束!!!");
//
//
//        //Objects方法
////        equals  --  多加了一个判断是否为null
////        isnull + nonnull
////        int[] arr = null;
////        System.out.println(Objects.isNull(arr));
//
//
//
//
//
//    }
    public static void main(String[] args) {
        //数组工具类
        //toString - 将数组以字符串的形式打印出来
//        int[][] arr = {
//                {1,2,3,4,5},
//                {2,3,4,5,6},
//                {3,4,5,6,7}
//        };
//        System.out.println(Arrays.toString(arr));

//        int[] arr = {1, 2, 3, 4, 5};
//        System.out.println(Arrays.toString(arr));

        //toString - 只能给一维数组

        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        //返回值索引值
//        System.out.println(Arrays.binarySearch(arr,2));
//        System.out.println(Arrays.binarySearch(arr,11));
//        System.out.println(Arrays.binarySearch(arr,0));




    }
}
